package com.yunhe.fineart;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;

import me.panpf.sketch.SketchImageView;

public class HDImageActivity extends Activity {
    private SketchImageView imageView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_hd_image);
        imageView = findViewById(R.id.imageView);
        imageView.setShowDownloadProgressEnabled(true, Color.DKGRAY);
        imageView.setZoomEnabled(true);
        String url = getIntent().getStringExtra("url");
        if (url != null) {
            imageView.displayImage(url);
        }

        ImageView back = findViewById(R.id.img_back);
        back.setOnClickListener(view -> finish());

    }
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        boolean result = true;
        try {
            result = super.dispatchTouchEvent(ev);
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
        return result;
    }
}